package GUIStudy.Basis.Event;

import javax.swing.*;
import java.awt.*;

public class Test {
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setSize(500, 500);
        frame.setLayout(new FlowLayout());
        JButton button1 = new JButton("按钮1");
        button1.addActionListener(new MyActionListener());
        frame.add(button1);
        JButton button2 = new JButton("按钮2");
        button2.addMouseListener(new MyMouseListener());
        frame.add(button2);
        JButton button3 = new JButton("按钮3");
        button3.addKeyListener(new MyKeyListener());
        frame.add(button3);
        frame.setDefaultCloseOperation(3);
        frame.setAlwaysOnTop(true);
        frame.setVisible(true);
    }
}
